package com.softserveinc.ita.kaiji.service;

import com.softserveinc.ita.kaiji.dto.GameInfoDto;
import com.softserveinc.ita.kaiji.model.Card;
import com.softserveinc.ita.kaiji.model.User;
import com.softserveinc.ita.kaiji.model.game.Game;
import com.softserveinc.ita.kaiji.model.game.GameHistory;
import com.softserveinc.ita.kaiji.model.game.GameInfo;
import com.softserveinc.ita.kaiji.model.player.Player;
/**
 * 	A service for a Game entity
 * @author Bohdan Shaposhnik
 * @version 1.1
 * @since 17.03.2014
 */
public interface GameService {
	
	/**
	 * @return human player id from game
	 */
	Integer getPlayerIdFromGame(Integer gameId);
	/**
	 * Finishes the game
	 * @param gameId - the game id
	 */
	void finishGame(Integer gameId);
	/**
	 * Initializes and inserts a new game into the pool
	 * @param gameInfoDto - a DTO for a game initialization
	 */
	Integer createGame(GameInfoDto gameInfoDto);
		
	/**
	 * @return GameInfo -the information of a game with specified id
	 * @param gameId - th game id
	 */
	GameInfo getGameInfo(Integer gameId);
	
	/**
	 * Returns a player with specified id (IT'S MOVING TO PlayerService ASAP!!!)
	 */
	Player getPlayerById(Integer playerId);//TODO move to PlayerService!!!
	/**
	 * Executes a turn
	 * @param gameId
	 * @param playerId
	 * @param card
	 */
	void makeTurn(Integer gameId, Integer playerId, Card card);
	
	/**
	 * @param gameId - the id of the current game
	 * @return true if the game is complete
	 */
	Game.State getGameStatus(Integer gameId);
	
	/**
	 * @param gameId - the id of the current game
	 * @return current history of turns
	 */
	GameHistory getGameHistory(Integer gameId);

    void addPlayer(User user, String gameName);

    public Integer getPlayerIdFromGame(String playerName, String gameName);

    public Integer getGameId(String gameName);
}
